<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Set options</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="mysqli.next-result.html">mysqli::next_result</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="mysqli.ping.html">mysqli::ping</a></div>
 <div class="up"><a href="class.mysqli.html">MySQLi</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="mysqli.options" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">mysqli::options</h1>
  <h1 class="refname">mysqli_options</h1>
  <p class="verinfo">(PHP 5)</p><p class="refpurpose"><span class="refname">mysqli::options</span> -- <span class="refname">mysqli_options</span> &mdash; <span class="dc-title">Set options</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-mysqli.options-description">
  <h3 class="title">说明</h3>
  <p class="para">面向对象风格</p>
  <div class="methodsynopsis dc-description">
   <span class="type">bool</span> <span class="methodname"><strong>mysqli::options</strong></span>
    ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$option</code></span>
   , <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$value</code></span>
   )</div>

  <p class="para rdfs-comment">过程化风格</p>
  <div class="methodsynopsis dc-description">
   <span class="type">bool</span> <span class="methodname"><strong>mysqli_options</strong></span>
    ( <span class="methodparam"><span class="type"><a href="class.mysqli.html" class="type mysqli">mysqli</a></span> <code class="parameter">$link</code></span>
   , <span class="methodparam"><span class="type">int</span> <code class="parameter">$option</code></span>
   , <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$value</code></span>
   )</div>

  <p class="para rdfs-comment">
   Used to set extra connect options and affect behavior for a connection.
  </p>
  <p class="para">
   This function may be called multiple times to set several options.
  </p>
  <p class="para">
   <span class="function"><strong>mysqli_options()</strong></span> should be called after
   <span class="function"><a href="mysqli.init.html" class="function">mysqli_init()</a></span> and before
   <span class="function"><a href="mysqli.real-connect.html" class="function">mysqli_real_connect()</a></span>.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-mysqli.options-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    <dt>
<em><code class="parameter">
link</code></em></dt>
<dd>
<p class="para">仅以过程化样式：由<span class="function"><a href="function.mysqli-connect.html" class="function">mysqli_connect()</a></span> 或 <span class="function"><a href="mysqli.init.html" class="function">mysqli_init()</a></span>
返回的链接标识。</p></dd>

    
     <dt>
<em><code class="parameter">option</code></em></dt>

     <dd>

      <p class="para">
       The option that you want to set. It can be one of the following values:
       <table class="doctable table">
        <caption><strong>Valid options</strong></caption>
        
         <thead>
          <tr>
           <th>Name</th>
           <th>Description</th>
          </tr>

         </thead>

         <tbody class="tbody">
          <tr>
           <td><strong><code>MYSQLI_OPT_CONNECT_TIMEOUT</code></strong></td>
           <td>connection timeout in seconds (supported on Windows with TCP/IP since PHP 5.3.1)</td>
          </tr>

          <tr>
           <td><strong><code>MYSQLI_OPT_LOCAL_INFILE</code></strong></td>
           <td>enable/disable use of <em>LOAD LOCAL INFILE</em></td>
          </tr>

          <tr>
           <td><strong><code>MYSQLI_INIT_COMMAND</code></strong></td>
           <td>command to execute after when connecting to MySQL server</td>
          </tr>

          <tr>
           <td><strong><code>MYSQLI_READ_DEFAULT_FILE</code></strong></td>
           <td>
            Read options from named option file instead of <var class="filename">my.cnf</var>
           </td>
          </tr>

          <tr>
           <td><strong><code>MYSQLI_READ_DEFAULT_GROUP</code></strong></td>
           <td>
            Read options from the named group from <var class="filename">my.cnf</var>
            or the file specified with <strong><code>MYSQL_READ_DEFAULT_FILE</code></strong>.
           </td>
          </tr>

          <tr>
           <td><strong><code>MYSQLI_SERVER_PUBLIC_KEY</code></strong></td>
           <td>
             RSA public key file used with the SHA-256 based authentication.
           </td>
          </tr>

         </tbody>
        
       </table>

      </p>
     </dd>

    
    
     <dt>
<em><code class="parameter">value</code></em></dt>

     <dd>

      <p class="para">
       The value for the option.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-mysqli.options-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   成功时返回 <strong><code>TRUE</code></strong>， 或者在失败时返回 <strong><code>FALSE</code></strong>。
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-mysqli.options-changelog">
  <h3 class="title">更新日志</h3>
  <p class="para">
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>版本</th>
       <th>说明</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>5.5.0</td>
       <td>
        The <strong><code>MYSQLI_SERVER_PUBLIC_KEY</code></strong> option was added.
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-mysqli.options-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   See <span class="function"><a href="mysqli.real-connect.html" class="function">mysqli_real_connect()</a></span>.
  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-mysqli.options-notes">
  <h3 class="title">注释</h3>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
<p class="para">MySQLnd 总是使用服务器的默认字符集。此字符集在连接握手／认证时发送，并被 mysqlnd
使用。</p><p class="para">Libmysqlclient 使用 <var class="filename">my.cnf</var> 中的默认字符集或者由在调用
<span class="function"><a href="mysqli.init.html" class="function">mysqli_init()</a></span> 之后，<span class="function"><a href="mysqli.real-connect.html" class="function">mysqli_real_connect()</a></span>
之前先调用 <span class="function"><strong>mysqli_options()</strong></span> 来指定。</p></p></blockquote>
 </div>


 <div class="refsect1 seealso" id="refsect1-mysqli.options-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="mysqli.init.html" class="function" rel="rdfs-seeAlso">mysqli_init()</a> - Initializes MySQLi and returns a resource for use with mysqli_real_connect()</span></li>
    <li class="member"><span class="function"><a href="mysqli.real-connect.html" class="function" rel="rdfs-seeAlso">mysqli_real_connect()</a> - Opens a connection to a mysql server</span></li>
   </ul>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="mysqli.next-result.html">mysqli::next_result</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="mysqli.ping.html">mysqli::ping</a></div>
 <div class="up"><a href="class.mysqli.html">MySQLi</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
